<?php
require_once("IList.php");

/**
 * Contains a list of parameters.
 * @author s.marletta
 * @version $Id: EmbraceParameters.php 6 2009-04-28 20:11:07Z embrace.toolkit $
 */
class EmbraceParameters implements IList {
	/**
	 * List of parameters.
	 * @var Array
	 */
	private $arrayParameters;

	/**
	 * Creates a Parameter Object.
	 */
	public function EmbraceParameters() {
		$this->arrayParameters = array();
	}
	
	/**
	 * Adds the specified parameter to the list.
	 * @param $paramName Name of the parameter.
	 * @param $paramValue value of the parameter
	 */
	public function addParameter($paramName, $paramValue) {
		if(empty($paramName))
			throw new Exception("No Parametername given.");
			
		if(empty($paramValue))
			throw new Exception("No Parametervalue given.");
			
		$this->arrayParameters[$paramName] = $paramValue;
	}

	/**
	 * Returns the specified parameter.
	 * @param $paramName Name of the parameter.
	 * @return False if not available.
	 */
	public function getParameter($paramName) {
		if(empty($paramName))
			throw new Exception("No Parametername given.");
			
		return isset($this->arrayParameters[$paramName]) ? $this->arrayParameters[$paramName] : false; 
	}
	
	/**
	 * (non-PHPdoc)
	 * @see embrace/lib/IList#toArray()
	 */
	public function toArray() {
		return $this->arrayParameters;
	}
}
?>